<?php
$arrayImage=array('images/1.jpg','images/2.jpg','images/3.jpg','images/4.jpg');
$arrayTitle=array('test1','test2','test3','test4');
$arrayDesc=array('Lorem ipsum dolor sit amet, consectetur adipiscing elit. ',
                 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                 Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
                 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                 Lorem ipsum dolor sit amet, consectetur adipiscing elit. ',
                 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                 Lorem ipsum dolor sit amet, consectetur adipiscing elit. ');
$arrayLink=array('http://www.google.com','http://www.yahoo.com','http://www.rediff.com','http://www.msn.com');


//echo implode('@_@',$arrayDesc);


if(isset($_POST['Submit']) && $_POST['Submit']!= '')
{
    
   // echo $_POST['Submit'].'<br>';
    $arrayImage=explode('@_@',$_POST['Image']);
    $arrayTitle=explode('@_@',$_POST['Title']);
    $arrayDesc=explode('@_@',$_POST['DescRiption']);
    $arrayLink=explode('@_@',$_POST['URl']);
   
   
   //echo count($arrayImage).'====='.$_POST['counter'];

    $counter=$_POST['counter'];
    $counter++;
   
    if($_POST['counter'] + (int)1 >= count($arrayImage))
    {
        $counter=0;
    }
    //echo $counter;
    $imageNAME=$arrayImage[$counter];
    $TITle=$arrayTitle[$counter];
    $DESc=$arrayDesc[$counter];
    $URl=$arrayLink[$counter];
    
}
else
{
    $counter=0;
    $imageNAME=$arrayImage[$counter];
    $TITle=$arrayTitle[$counter];
    $DESc=$arrayDesc[$counter];
    $URl=$arrayLink[$counter];
}

?>

<form name="ads" id="ads" method="post" action="">
  <input type="hidden" name="counter" id="counter" value="<?php echo $counter;?>">

  <input type="hidden" name="Image" id="Image" value="<?php echo implode('@_@',$arrayImage);?>">

  <input type="hidden" name="Title" id="Title" value="<?php echo implode('@_@',$arrayTitle);?>">

  <input type="hidden" name="DescRiption" id="DescRiption" value="<?php echo implode('@_@',$arrayDesc);?>">

  <input type="hidden" name="URl" id="URl" value="<?php echo implode('@_@',$arrayLink)?>">
  
  <input type="hidden" name="Submit" id="Submit" value="Submit">
 
  
</form>

<div style="width:300px; height:300px; border:#000000 1px groove;">
    <a href="<?=$URl?>"><?=$TITle?></a><br>
    <a href="<?=$URl?>"><img src="<?php echo $imageNAME; ?>" border="0"></a><br>
    <?=$DESc?><br>
    <br>
</div>

<script>
setTimeout("SUBMITfunction();",4000);
function SUBMITfunction()
{
    document.getElementById("ads").submit();
}
</script>







